import com.alibaba.fastjson.JSON;
import com.google.gson.Gson;
import com.estate.common.utils.StringUtils;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.json.GsonJsonParser;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.web.client.RestTemplate;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;

public class testProject {
    @Test
    public void test01() {

        //分割元素为list
        List list = new ArrayList<>();
        list.add("aaa");
//            list.add("aaa");




        ArrayList<String> arrList=(ArrayList<String>)list;
        System.out.println(arrList);
        System.out.println(JSON.toJSONString(arrList));
    }
    @Test
    public void test02() {
        String jsonString="['xxx.png']";
        //否则拿出一个则先转换为list,后转json存入数据库
        Gson gson=new Gson();
        List<Object> objects = gson.fromJson(jsonString,List.class);
        objects.add("aaa");

        String s = gson.toJson(objects);

        System.out.println(objects);

        System.out.println(s);

    }
    @Test
    public void test03() {
        String jsonString="['xxx.png']";
        //否则拿出一个则先转换为list,后转json存入数据库
        Gson gson=new Gson();
        ArrayList arrayList = gson.fromJson(jsonString,ArrayList.class);
        arrayList.remove("xxx.png");
        System.out.println(arrayList);



    }
    @Test
    public void test04() {
       int num=25;
       int div=10;
       int res=0;
       if(num%div==0){
           res=num/div;
           System.out.println(res);
       }else{
           res=(num/div)+1;
           System.out.println(res);

       }




    }






}
